<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <title>按钮定义管理</title>
    <%@ include file="../../common/meta.jsp" %>
    <link href="${ctx}/css/page/common-list.css?t=${now}" rel="stylesheet">
    <link href="${ctx}/css/page/common-search.css?t=${now}" rel="stylesheet">
</head>
<style>
</style>
<script>
    var searchInfo = '${searchInfo}';
    var statusMap = '${statusMap}';
    var menuMap = '${menuMap}';
</script>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5><i class="fa fa-search"></i> 筛选查询</h5>
                </div>
                <div class="ibox-content ibox-content-search">
                    <form class="form-horizontal m-t" id="searchForm" novalidate="novalidate">
                        <div class="form-group">
                            <label class="col-sm-1 control-label">菜单：</label>
                            <div class="col-sm-2">
                                <select class="form-control" name="menuId" id="menuId" onchange="doChooseTab()">
                                    <option value="">--请选择--</option>
                                    <c:forEach items="${menuMap}" var="item">
                                        <option value="${item.code}" ${not empty searchInfo && searchInfo.menuId == item.code ? 'selected' : '' } >${item.name}</option>
                                    </c:forEach>
                                </select>
                            </div>
                            <label class="col-sm-1 control-label">TAB页：</label>
                            <div class="col-sm-2">
                                <select class="form-control" name="tabId" id="tabId" onchange="doRefresh()">
                                    <option value="">--请选择--</option>
                                    <c:forEach items="${tabMap}" var="item">
                                        <option value="${item.code}" ${not empty searchInfo && searchInfo.tabId == item.code ? 'selected' : '' } >${item.name}</option>
                                    </c:forEach>
                                </select>
                            </div>
                            <label class="col-sm-1 control-label">状态：</label>
                            <div class="col-sm-2">
                                <select class="form-control" name="status" id="status" onchange="doRefresh()">
                                    <option value="">--请选择--</option>
                                    <c:forEach items="${statusMap}" var="item">
                                        <c:if test="${item.key!='delete'}">
                                            <option value="${item.key}" ${not empty searchInfo && searchInfo.status == item.key ? 'selected' : '' } >${item.value}</option>
                                        </c:if>
                                    </c:forEach>
                                </select>
                            </div>
                            <div class="ibox-tools ibox-tools-search">
                                <button type="button" class="btn btn-primary btn-outline" onclick="doRefresh()">查询</button>
                                <button type="button" class="btn btn-primary btn-outline" onclick="clearFrom('searchForm')">重置</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5><i class="fa fa-table"></i> 按钮信息</h5>
                    <div class="ibox-tools col-sm-offset-2">
                        <c:if test="${userType == 'super' || not empty btnMap['addBtn']}">
                            <button class="btn btn-primary btn-outline" onclick="openAddBtnPage()">新建</button>
                        </c:if>
                        <c:if test="${userType == 'super' || not empty btnMap['editBtn']}">
                            <button class="btn btn-primary btn-outline" onclick="openEditBtnPage()">编辑</button>
                        </c:if>
                        <c:if test="${userType == 'super' || not empty btnMap['stateBtn']}">
                            <button class="btn btn-primary btn-outline change_text" onclick="changeState()">冻结</button>
                        </c:if>
                        <c:if test="${userType == 'super' || not empty btnMap['delBtn']}">
                            <button class="btn btn-primary btn-outline" onclick="deleteBtn()">删除</button>
                        </c:if>
                        <button class="btn btn-primary btn-outline" type="submit" onclick="doRefresh()">刷新</button>
                    </div>
                </div>
                <div class="ibox-content">
                    <table class='table table-striped table-hover'
                           id="dataTable"  data-height="400"
                           data-toggle="table"
                           data-url="${ctx}/pfButton/pageFindButtonData?t=${now}"
                           data-pagination="true"
                           data-side-pagination="server"
                           data-striped="true"
                           data-response-handler="handleServerResult"
                           data-query-params-type=""
                           data-query-params="getParams"
                           data-page-number="${not empty searchInfo.pageNo ? searchInfo.pageNo : 1}"
                           data-page-size="${not empty searchInfo.pageSize ? searchInfo.pageSize : defaultPageSize}"
                           data-page-list="${pageList}">
                        <thead>
                        <tr>
                            <th data-field="id" data-visible="false">ID</th>
                            <th data-field="menuId" data-visible="false">菜单ID</th>
                            <th data-field="tabId" data-visible="false">TAB页ID</th>
                            <th data-field="status" data-align="center" data-formatter="formatStatus" data-width="80px">状态</th>
                            <th data-field="btnName" data-align="center" data-width="150px" data-formatter="formatName" data-events="actionEvents">按钮名称</th>
                            <th data-field="btnCode" data-align="center" data-width="150px">按钮编码</th>
                            <th data-field="menuName" data-align="center" data-width="140px">菜单</th>
                            <th data-field="tabName" data-align="center" data-width="140px">TAB页</th>
                            <th data-field="sortNum" data-align="center" data-width="80px">排序</th>
                            <th data-field="creator" data-align="center"  data-width="100px" data-formatter="formatterCreator" >创建人</th>
                            <th data-field="operator" data-width="100px"  data-align="center" data-formatter="formatterOperator" >编辑人</th>
                        </tr>
                        </thead>
                    </table>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-sm-12">
            <div class="text-center">${companyName}</div>
        </div>
    </div>
</div>
<script src="${ctx}/js/sys/button/buttonMgr.js?t=${now}"></script>
</body>
</html>

